﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SerialPortWindow
{
    public enum BaffleStates
    {
        None = 0, //没有
        Left = 1, //左
        Right = 2, //右
    };

    public class P5SerialPortMessage
    {
        /// <summary>
        /// 左上压力值
        /// </summary>
        public int LeftTop { get; set; }
        /// <summary>
        /// 左下压力值
        /// </summary>
        public int LeftBottom { get; set; }
        /// <summary>
        /// 右上压力值
        /// </summary>
        public int RightTop { get; set; }
        /// <summary>
        /// 右下压力值
        /// </summary>
        public int RightBottom { get; set; }
        /// <summary>
        /// 减重值
        /// </summary>
        public int LossWeight { get; set; }
        /// <summary>
        /// 挡板状态
        /// </summary>
        public BaffleStates BaffleState { get; set; }
        /// <summary>
        /// 触碰挡板标志
        /// </summary>
        public bool TouchBaffle { get; set; }
        /// <summary>
        /// 扶手高度
        /// </summary>
        public int HandrailHeight { get; set; }
        /// <summary>
        /// 急停状态
        /// </summary>
        public int EmergencyCheck { get; set; }
        /// <summary>
        /// 急停状态
        /// </summary>
        public int EmergencyStatus { get; set; }

        public int TopSum => Math.Max(1, LeftTop + RightTop);
        public int BottomSum => Math.Max(1, LeftBottom + RightBottom);
        public int LeftSum => Math.Max(1, LeftTop + LeftBottom);
        public int RightSum => Math.Max(1, RightTop + RightBottom);
        public int TotalSum => LeftSum + RightSum;

        public P5SerialPortMessage()
        {
            LeftTop = 0;
            LeftBottom = 0;
            RightTop = 0;
            RightBottom = 0;
            HandrailHeight = 0;
            EmergencyCheck = 0;
            EmergencyStatus = 0;
            TouchBaffle = false;
            BaffleState = BaffleStates.None;
        }
    }
}
